package com.wuchao.controller;


import com.wuchao.response.R;
import com.wuchao.service.DepartmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.shiro.authz.annotation.RequiresUser;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wuchao
 * @since 2023-12-12
 */
@RestController
@RequestMapping("/department")
@CrossOrigin
@Api("部门")

public class DepartmentController {
    @Resource
    private DepartmentService departmentService;
//    @RequiresPermissions("menu:add")
    //@RequiresUser es()
    @ApiOperation("查询部门名称带0")
    @GetMapping("findDepartMent")
    public R findDepartMent(){
        return R.ok().data("deptList",departmentService.findDepartMentList());
    }

    @ApiOperation("查询部门")
    @GetMapping("findDepar")
    public R findDepart(){
        Integer[] findcounts = departmentService.findcounts();
        String[] findname = departmentService.findname();
        List<String> list = Arrays.asList(findname);
        List<Integer> integers = Arrays.asList(findcounts);
        return R.ok().data("names",list).data("counts",integers);
    }
}

